package com.dt.platform.domain.hr;

import com.github.foxnic.dao.entity.Entity;
import io.swagger.annotations.ApiModel;
import javax.persistence.Table;
import com.github.foxnic.sql.meta.DBTable;
import com.dt.platform.constants.db.HrTables.HR_PAPER_QUESTION;
import javax.persistence.Id;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Transient;
import com.github.foxnic.api.swagger.EnumFor;
import org.github.foxnic.web.domain.system.DictItem;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.foxnic.commons.lang.DataParser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import com.github.foxnic.dao.entity.EntityContext;
import com.dt.platform.domain.hr.meta.PaperQuestionMeta;
import com.github.foxnic.sql.data.ExprRcd;



/**
 * 考试题目
 * <p>考试题目 , 数据表 hr_paper_question 的PO类型</p>
 * @author 金杰 , maillank@qq.com
 * @since 2024-10-04 20:22:57
 * @sign 0F99A2B5711E41AE8FEE786C1B83018F
 * 此文件由工具自动生成，请勿修改。若表结构或配置发生变动，请使用工具重新生成。
*/

@Table(name = "hr_paper_question")
@ApiModel(description = "考试题目 ; 考试题目 , 数据表 hr_paper_question 的PO类型")
public class PaperQuestion extends Entity {

	private static final long serialVersionUID = 1L;

	public static final DBTable TABLE =HR_PAPER_QUESTION.$TABLE;
	
	/**
	 * 主键：主键
	*/
	@Id
	@ApiModelProperty(required = true,value="主键" , notes = "主键" , example = "609760783458369541")
	private String id;
	
	/**
	 * 学习课程：学习课程
	*/
	@ApiModelProperty(required = false,value="学习课程" , notes = "学习课程")
	private String learnId;
	
	/**
	 * 题库名称：题库名称
	*/
	@ApiModelProperty(required = false,value="题库名称" , notes = "题库名称" , example = "591815108767815")
	private String paperId;
	
	/**
	 * 题目状态：题目状态
	*/
	@ApiModelProperty(required = false,value="题目状态" , notes = "题目状态" , example = "valid")
	private String status;
	
	/**
	 * 题目类型：题目类型
	*/
	@ApiModelProperty(required = false,value="题目类型" , notes = "题目类型" , example = "radio")
	private String questionType;
	
	/**
	 * 题目名称：题目名称
	*/
	@ApiModelProperty(required = false,value="题目名称" , notes = "题目名称" , example = "一周有几天?")
	private String name;
	
	/**
	 * 图片：图片
	*/
	@ApiModelProperty(required = false,value="图片" , notes = "图片")
	private String imageId;
	
	/**
	 * 附件：附件
	*/
	@ApiModelProperty(required = false,value="附件" , notes = "附件")
	private String fileId;
	
	/**
	 * 建议得分：建议得分
	*/
	@ApiModelProperty(required = false,value="建议得分" , notes = "建议得分" , example = "10.0")
	private BigDecimal score;
	
	/**
	 * 题目难度：题目难度
	*/
	@ApiModelProperty(required = false,value="题目难度" , notes = "题目难度" , example = "easy")
	private String questionLevel;
	
	/**
	 * 题目解析：题目解析
	*/
	@ApiModelProperty(required = false,value="题目解析" , notes = "题目解析")
	private String questionAnalysis;
	
	/**
	 * 序号：序号
	*/
	@ApiModelProperty(required = false,value="序号" , notes = "序号" , example = "1")
	private Integer questionNumber;
	
	/**
	 * 排序：排序
	*/
	@ApiModelProperty(required = false,value="排序" , notes = "排序" , example = "0")
	private Integer sort;
	
	/**
	 * 创建人ID：创建人ID
	*/
	@ApiModelProperty(required = false,value="创建人ID" , notes = "创建人ID")
	private String createBy;
	
	/**
	 * 创建时间：创建时间
	*/
	@ApiModelProperty(required = false,value="创建时间" , notes = "创建时间")
	private Date createTime;
	
	/**
	 * 修改人ID：修改人ID
	*/
	@ApiModelProperty(required = false,value="修改人ID" , notes = "修改人ID")
	private String updateBy;
	
	/**
	 * 修改时间：修改时间
	*/
	@ApiModelProperty(required = false,value="修改时间" , notes = "修改时间")
	private Date updateTime;
	
	/**
	 * 是否已删除：是否已删除
	*/
	@ApiModelProperty(required = true,value="是否已删除" , notes = "是否已删除" , example = "0")
	private Integer deleted;
	@Transient
	@EnumFor("deleted")
	private Boolean deletedBool;
	
	/**
	 * 删除人ID：删除人ID
	*/
	@ApiModelProperty(required = false,value="删除人ID" , notes = "删除人ID")
	private String deleteBy;
	
	/**
	 * 删除时间：删除时间
	*/
	@ApiModelProperty(required = false,value="删除时间" , notes = "删除时间")
	private Date deleteTime;
	
	/**
	 * version：version
	*/
	@ApiModelProperty(required = true,value="version" , notes = "version" , example = "1")
	private Integer version;
	
	/**
	 * levelDict：levelDict
	*/
	@ApiModelProperty(required = false,value="levelDict" , notes = "levelDict")
	private DictItem levelDict;
	
	/**
	 * learnPaper：learnPaper
	*/
	@ApiModelProperty(required = false,value="learnPaper" , notes = "learnPaper")
	private LearnPaper learnPaper;
	
	/**
	 * learn：learn
	*/
	@ApiModelProperty(required = false,value="learn" , notes = "learn")
	private Learn learn;
	
	/**
	 * paperQuestionItemList：paperQuestionItemList
	*/
	@ApiModelProperty(required = false,value="paperQuestionItemList" , notes = "paperQuestionItemList")
	private List<PaperQuestionItem> paperQuestionItemList;
	
	/**
	 * paperQuestionAnswerList：paperQuestionAnswerList
	*/
	@ApiModelProperty(required = false,value="paperQuestionAnswerList" , notes = "paperQuestionAnswerList")
	private List<PaperQuestionAnswer> paperQuestionAnswerList;
	
	/**
	 * queryOwner：queryOwner
	*/
	@ApiModelProperty(required = false,value="queryOwner" , notes = "queryOwner")
	private String queryOwner;
	
	/**
	 * selectedCode：selectedCode
	*/
	@ApiModelProperty(required = false,value="selectedCode" , notes = "selectedCode")
	private String selectedCode;
	
	/**
	 * 获得 主键<br>
	 * 主键
	 * @return 主键
	*/
	public String getId() {
		return id;
	}
	
	/**
	 * 设置 主键
	 * @param id 主键
	 * @return 当前对象
	*/
	public PaperQuestion setId(String id) {
		this.id=id;
		return this;
	}
	
	/**
	 * 获得 学习课程<br>
	 * 学习课程
	 * @return 学习课程
	*/
	public String getLearnId() {
		return learnId;
	}
	
	/**
	 * 设置 学习课程
	 * @param learnId 学习课程
	 * @return 当前对象
	*/
	public PaperQuestion setLearnId(String learnId) {
		this.learnId=learnId;
		return this;
	}
	
	/**
	 * 获得 题库名称<br>
	 * 题库名称
	 * @return 题库名称
	*/
	public String getPaperId() {
		return paperId;
	}
	
	/**
	 * 设置 题库名称
	 * @param paperId 题库名称
	 * @return 当前对象
	*/
	public PaperQuestion setPaperId(String paperId) {
		this.paperId=paperId;
		return this;
	}
	
	/**
	 * 获得 题目状态<br>
	 * 题目状态
	 * @return 题目状态
	*/
	public String getStatus() {
		return status;
	}
	
	/**
	 * 设置 题目状态
	 * @param status 题目状态
	 * @return 当前对象
	*/
	public PaperQuestion setStatus(String status) {
		this.status=status;
		return this;
	}
	
	/**
	 * 获得 题目类型<br>
	 * 题目类型
	 * @return 题目类型
	*/
	public String getQuestionType() {
		return questionType;
	}
	
	/**
	 * 设置 题目类型
	 * @param questionType 题目类型
	 * @return 当前对象
	*/
	public PaperQuestion setQuestionType(String questionType) {
		this.questionType=questionType;
		return this;
	}
	
	/**
	 * 获得 题目名称<br>
	 * 题目名称
	 * @return 题目名称
	*/
	public String getName() {
		return name;
	}
	
	/**
	 * 设置 题目名称
	 * @param name 题目名称
	 * @return 当前对象
	*/
	public PaperQuestion setName(String name) {
		this.name=name;
		return this;
	}
	
	/**
	 * 获得 图片<br>
	 * 图片
	 * @return 图片
	*/
	public String getImageId() {
		return imageId;
	}
	
	/**
	 * 设置 图片
	 * @param imageId 图片
	 * @return 当前对象
	*/
	public PaperQuestion setImageId(String imageId) {
		this.imageId=imageId;
		return this;
	}
	
	/**
	 * 获得 附件<br>
	 * 附件
	 * @return 附件
	*/
	public String getFileId() {
		return fileId;
	}
	
	/**
	 * 设置 附件
	 * @param fileId 附件
	 * @return 当前对象
	*/
	public PaperQuestion setFileId(String fileId) {
		this.fileId=fileId;
		return this;
	}
	
	/**
	 * 获得 建议得分<br>
	 * 建议得分
	 * @return 建议得分
	*/
	public BigDecimal getScore() {
		return score;
	}
	
	/**
	 * 设置 建议得分
	 * @param score 建议得分
	 * @return 当前对象
	*/
	public PaperQuestion setScore(BigDecimal score) {
		this.score=score;
		return this;
	}
	
	/**
	 * 获得 题目难度<br>
	 * 题目难度
	 * @return 题目难度
	*/
	public String getQuestionLevel() {
		return questionLevel;
	}
	
	/**
	 * 设置 题目难度
	 * @param questionLevel 题目难度
	 * @return 当前对象
	*/
	public PaperQuestion setQuestionLevel(String questionLevel) {
		this.questionLevel=questionLevel;
		return this;
	}
	
	/**
	 * 获得 题目解析<br>
	 * 题目解析
	 * @return 题目解析
	*/
	public String getQuestionAnalysis() {
		return questionAnalysis;
	}
	
	/**
	 * 设置 题目解析
	 * @param questionAnalysis 题目解析
	 * @return 当前对象
	*/
	public PaperQuestion setQuestionAnalysis(String questionAnalysis) {
		this.questionAnalysis=questionAnalysis;
		return this;
	}
	
	/**
	 * 获得 序号<br>
	 * 序号
	 * @return 序号
	*/
	public Integer getQuestionNumber() {
		return questionNumber;
	}
	
	/**
	 * 设置 序号
	 * @param questionNumber 序号
	 * @return 当前对象
	*/
	public PaperQuestion setQuestionNumber(Integer questionNumber) {
		this.questionNumber=questionNumber;
		return this;
	}
	
	/**
	 * 获得 排序<br>
	 * 排序
	 * @return 排序
	*/
	public Integer getSort() {
		return sort;
	}
	
	/**
	 * 设置 排序
	 * @param sort 排序
	 * @return 当前对象
	*/
	public PaperQuestion setSort(Integer sort) {
		this.sort=sort;
		return this;
	}
	
	/**
	 * 获得 创建人ID<br>
	 * 创建人ID
	 * @return 创建人ID
	*/
	public String getCreateBy() {
		return createBy;
	}
	
	/**
	 * 设置 创建人ID
	 * @param createBy 创建人ID
	 * @return 当前对象
	*/
	public PaperQuestion setCreateBy(String createBy) {
		this.createBy=createBy;
		return this;
	}
	
	/**
	 * 获得 创建时间<br>
	 * 创建时间
	 * @return 创建时间
	*/
	public Date getCreateTime() {
		return createTime;
	}
	
	/**
	 * 设置 创建时间
	 * @param createTime 创建时间
	 * @return 当前对象
	*/
	public PaperQuestion setCreateTime(Date createTime) {
		this.createTime=createTime;
		return this;
	}
	
	/**
	 * 获得 修改人ID<br>
	 * 修改人ID
	 * @return 修改人ID
	*/
	public String getUpdateBy() {
		return updateBy;
	}
	
	/**
	 * 设置 修改人ID
	 * @param updateBy 修改人ID
	 * @return 当前对象
	*/
	public PaperQuestion setUpdateBy(String updateBy) {
		this.updateBy=updateBy;
		return this;
	}
	
	/**
	 * 获得 修改时间<br>
	 * 修改时间
	 * @return 修改时间
	*/
	public Date getUpdateTime() {
		return updateTime;
	}
	
	/**
	 * 设置 修改时间
	 * @param updateTime 修改时间
	 * @return 当前对象
	*/
	public PaperQuestion setUpdateTime(Date updateTime) {
		this.updateTime=updateTime;
		return this;
	}
	
	/**
	 * 获得 是否已删除<br>
	 * 是否已删除
	 * @return 是否已删除
	*/
	public Integer getDeleted() {
		return deleted;
	}
	
	/**
	 * 获得 是否已删除 的投影属性<br>
	 * 等价于 getDeleted 方法，获得对应的枚举类型
	 * @return 是否已删除
	*/
	@Transient
	public Boolean isDeleted() {
		if(this.deletedBool==null) {
			this.deletedBool=DataParser.parseBoolean(deleted);
		}
		return this.deletedBool ;
	}
	
	/**
	 * 设置 是否已删除
	 * @param deleted 是否已删除
	 * @return 当前对象
	*/
	@JsonProperty("deleted")
	public PaperQuestion setDeleted(Integer deleted) {
		this.deleted=deleted;
		this.deletedBool=DataParser.parseBoolean(deleted);
		return this;
	}
	
	/**
	 * 设置 是否已删除的投影属性，等同于设置 是否已删除
	 * @param deletedBool 是否已删除
	 * @return 当前对象
	*/
	@Transient
	public PaperQuestion setDeleted(Boolean deletedBool) {
		if(deletedBool==null) {
			this.deleted=null;
		} else {
			this.deleted=deletedBool?1:0;
		}
		this.deletedBool=deletedBool;
		return this;
	}
	
	/**
	 * 获得 删除人ID<br>
	 * 删除人ID
	 * @return 删除人ID
	*/
	public String getDeleteBy() {
		return deleteBy;
	}
	
	/**
	 * 设置 删除人ID
	 * @param deleteBy 删除人ID
	 * @return 当前对象
	*/
	public PaperQuestion setDeleteBy(String deleteBy) {
		this.deleteBy=deleteBy;
		return this;
	}
	
	/**
	 * 获得 删除时间<br>
	 * 删除时间
	 * @return 删除时间
	*/
	public Date getDeleteTime() {
		return deleteTime;
	}
	
	/**
	 * 设置 删除时间
	 * @param deleteTime 删除时间
	 * @return 当前对象
	*/
	public PaperQuestion setDeleteTime(Date deleteTime) {
		this.deleteTime=deleteTime;
		return this;
	}
	
	/**
	 * 获得 version<br>
	 * version
	 * @return version
	*/
	public Integer getVersion() {
		return version;
	}
	
	/**
	 * 设置 version
	 * @param version version
	 * @return 当前对象
	*/
	public PaperQuestion setVersion(Integer version) {
		this.version=version;
		return this;
	}
	
	/**
	 * 获得 levelDict<br>
	 * levelDict
	 * @return levelDict
	*/
	public DictItem getLevelDict() {
		return levelDict;
	}
	
	/**
	 * 设置 levelDict
	 * @param levelDict levelDict
	 * @return 当前对象
	*/
	public PaperQuestion setLevelDict(DictItem levelDict) {
		this.levelDict=levelDict;
		return this;
	}
	
	/**
	 * 获得 learnPaper<br>
	 * learnPaper
	 * @return learnPaper
	*/
	public LearnPaper getLearnPaper() {
		return learnPaper;
	}
	
	/**
	 * 设置 learnPaper
	 * @param learnPaper learnPaper
	 * @return 当前对象
	*/
	public PaperQuestion setLearnPaper(LearnPaper learnPaper) {
		this.learnPaper=learnPaper;
		return this;
	}
	
	/**
	 * 获得 learn<br>
	 * learn
	 * @return learn
	*/
	public Learn getLearn() {
		return learn;
	}
	
	/**
	 * 设置 learn
	 * @param learn learn
	 * @return 当前对象
	*/
	public PaperQuestion setLearn(Learn learn) {
		this.learn=learn;
		return this;
	}
	
	/**
	 * 获得 paperQuestionItemList<br>
	 * paperQuestionItemList
	 * @return paperQuestionItemList
	*/
	public List<PaperQuestionItem> getPaperQuestionItemList() {
		return paperQuestionItemList;
	}
	
	/**
	 * 设置 paperQuestionItemList
	 * @param paperQuestionItemList paperQuestionItemList
	 * @return 当前对象
	*/
	public PaperQuestion setPaperQuestionItemList(List<PaperQuestionItem> paperQuestionItemList) {
		this.paperQuestionItemList=paperQuestionItemList;
		return this;
	}
	
	/**
	 * 添加 paperQuestionItemList
	 * @param paperQuestionItem paperQuestionItemList
	 * @return 当前对象
	*/
	public PaperQuestion addPaperQuestionItem(PaperQuestionItem... paperQuestionItem) {
		if(this.paperQuestionItemList==null) {
			paperQuestionItemList=new ArrayList<>();
		}
		this.paperQuestionItemList.addAll(Arrays.asList(paperQuestionItem));
		return this;
	}
	
	/**
	 * 获得 paperQuestionAnswerList<br>
	 * paperQuestionAnswerList
	 * @return paperQuestionAnswerList
	*/
	public List<PaperQuestionAnswer> getPaperQuestionAnswerList() {
		return paperQuestionAnswerList;
	}
	
	/**
	 * 设置 paperQuestionAnswerList
	 * @param paperQuestionAnswerList paperQuestionAnswerList
	 * @return 当前对象
	*/
	public PaperQuestion setPaperQuestionAnswerList(List<PaperQuestionAnswer> paperQuestionAnswerList) {
		this.paperQuestionAnswerList=paperQuestionAnswerList;
		return this;
	}
	
	/**
	 * 添加 paperQuestionAnswerList
	 * @param paperQuestionAnswer paperQuestionAnswerList
	 * @return 当前对象
	*/
	public PaperQuestion addPaperQuestionAnswer(PaperQuestionAnswer... paperQuestionAnswer) {
		if(this.paperQuestionAnswerList==null) {
			paperQuestionAnswerList=new ArrayList<>();
		}
		this.paperQuestionAnswerList.addAll(Arrays.asList(paperQuestionAnswer));
		return this;
	}
	
	/**
	 * 获得 queryOwner<br>
	 * queryOwner
	 * @return queryOwner
	*/
	public String getQueryOwner() {
		return queryOwner;
	}
	
	/**
	 * 设置 queryOwner
	 * @param queryOwner queryOwner
	 * @return 当前对象
	*/
	public PaperQuestion setQueryOwner(String queryOwner) {
		this.queryOwner=queryOwner;
		return this;
	}
	
	/**
	 * 获得 selectedCode<br>
	 * selectedCode
	 * @return selectedCode
	*/
	public String getSelectedCode() {
		return selectedCode;
	}
	
	/**
	 * 设置 selectedCode
	 * @param selectedCode selectedCode
	 * @return 当前对象
	*/
	public PaperQuestion setSelectedCode(String selectedCode) {
		this.selectedCode=selectedCode;
		return this;
	}

	/**
	 * 将自己转换成指定类型的PO
	 * @param poType  PO类型
	 * @return PaperQuestion , 转换好的 PaperQuestion 对象
	*/
	@Transient
	public <T extends Entity> T toPO(Class<T> poType) {
		return EntityContext.create(poType, this);
	}

	/**
	 * 将自己转换成任意指定类型
	 * @param pojoType  Pojo类型
	 * @return PaperQuestion , 转换好的 PoJo 对象
	*/
	@Transient
	public <T> T toPojo(Class<T> pojoType) {
		if(Entity.class.isAssignableFrom(pojoType)) {
			return (T)this.toPO((Class<Entity>)pojoType);
		}
		try {
			T pojo=pojoType.newInstance();
			EntityContext.copyProperties(pojo, this);
			return pojo;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	/**
	 * 克隆当前对象
	*/
	@Transient
	public PaperQuestion clone() {
		return duplicate(true);
	}

	/**
	 * 复制当前对象
	 * @param all 是否复制全部属性，当 false 时，仅复制来自数据表的属性
	*/
	@Transient
	public PaperQuestion duplicate(boolean all) {
		com.dt.platform.domain.hr.meta.PaperQuestionMeta.$$proxy$$ inst = new com.dt.platform.domain.hr.meta.PaperQuestionMeta.$$proxy$$();
		inst.setImageId(this.getImageId());
		inst.setUpdateTime(this.getUpdateTime());
		inst.setSort(this.getSort());
		inst.setVersion(this.getVersion());
		inst.setQuestionNumber(this.getQuestionNumber());
		inst.setScore(this.getScore());
		inst.setCreateBy(this.getCreateBy());
		inst.setDeleted(this.getDeleted());
		inst.setCreateTime(this.getCreateTime());
		inst.setUpdateBy(this.getUpdateBy());
		inst.setDeleteTime(this.getDeleteTime());
		inst.setName(this.getName());
		inst.setLearnId(this.getLearnId());
		inst.setDeleteBy(this.getDeleteBy());
		inst.setId(this.getId());
		inst.setQuestionType(this.getQuestionType());
		inst.setQuestionLevel(this.getQuestionLevel());
		inst.setPaperId(this.getPaperId());
		inst.setStatus(this.getStatus());
		inst.setFileId(this.getFileId());
		inst.setQuestionAnalysis(this.getQuestionAnalysis());
		if(all) {
			inst.setQueryOwner(this.getQueryOwner());
			inst.setLearn(this.getLearn());
			inst.setLearnPaper(this.getLearnPaper());
			inst.setLevelDict(this.getLevelDict());
			inst.setPaperQuestionItemList(this.getPaperQuestionItemList());
			inst.setPaperQuestionAnswerList(this.getPaperQuestionAnswerList());
			inst.setSelectedCode(this.getSelectedCode());
		}
		inst.clearModifies();
		return inst;
	}

	/**
	 * 克隆当前对象
	*/
	@Transient
	public PaperQuestion clone(boolean deep) {
		return EntityContext.clone(PaperQuestion.class,this,deep);
	}

	/**
	 * 将 Map 转换成 PaperQuestion
	 * @param paperQuestionMap 包含实体信息的 Map 对象
	 * @return PaperQuestion , 转换好的的 PaperQuestion 对象
	*/
	@Transient
	public static PaperQuestion createFrom(Map<String,Object> paperQuestionMap) {
		if(paperQuestionMap==null) return null;
		PaperQuestion po = create();
		EntityContext.copyProperties(po,paperQuestionMap);
		po.clearModifies();
		return po;
	}

	/**
	 * 将 Pojo 转换成 PaperQuestion
	 * @param pojo 包含实体信息的 Pojo 对象
	 * @return PaperQuestion , 转换好的的 PaperQuestion 对象
	*/
	@Transient
	public static PaperQuestion createFrom(Object pojo) {
		if(pojo==null) return null;
		PaperQuestion po = create();
		EntityContext.copyProperties(po,pojo);
		po.clearModifies();
		return po;
	}

	/**
	 * 创建一个 PaperQuestion，等同于 new
	 * @return PaperQuestion 对象
	*/
	@Transient
	public static PaperQuestion create() {
		return new com.dt.platform.domain.hr.meta.PaperQuestionMeta.$$proxy$$();
	}

	/**
	 * 从 Map 读取
	 * @param map 记录数据
	 * @param cast 是否用 DataParser 进行类型转换
	 * @return  是否读取成功
	*/
	public boolean read(Map<String, Object> map,boolean cast) {
		if(map==null) return false;
		if(cast) {
			this.setImageId(DataParser.parse(String.class, map.get(PaperQuestionMeta.IMAGE_ID)));
			this.setUpdateTime(DataParser.parse(Date.class, map.get(PaperQuestionMeta.UPDATE_TIME)));
			this.setSort(DataParser.parse(Integer.class, map.get(PaperQuestionMeta.SORT)));
			this.setVersion(DataParser.parse(Integer.class, map.get(PaperQuestionMeta.VERSION)));
			this.setQuestionNumber(DataParser.parse(Integer.class, map.get(PaperQuestionMeta.QUESTION_NUMBER)));
			this.setScore(DataParser.parse(BigDecimal.class, map.get(PaperQuestionMeta.SCORE)));
			this.setCreateBy(DataParser.parse(String.class, map.get(PaperQuestionMeta.CREATE_BY)));
			this.setDeleted(DataParser.parse(Integer.class, map.get(PaperQuestionMeta.DELETED)));
			this.setCreateTime(DataParser.parse(Date.class, map.get(PaperQuestionMeta.CREATE_TIME)));
			this.setUpdateBy(DataParser.parse(String.class, map.get(PaperQuestionMeta.UPDATE_BY)));
			this.setDeleteTime(DataParser.parse(Date.class, map.get(PaperQuestionMeta.DELETE_TIME)));
			this.setName(DataParser.parse(String.class, map.get(PaperQuestionMeta.NAME)));
			this.setLearnId(DataParser.parse(String.class, map.get(PaperQuestionMeta.LEARN_ID)));
			this.setDeleteBy(DataParser.parse(String.class, map.get(PaperQuestionMeta.DELETE_BY)));
			this.setId(DataParser.parse(String.class, map.get(PaperQuestionMeta.ID)));
			this.setQuestionType(DataParser.parse(String.class, map.get(PaperQuestionMeta.QUESTION_TYPE)));
			this.setQuestionLevel(DataParser.parse(String.class, map.get(PaperQuestionMeta.QUESTION_LEVEL)));
			this.setPaperId(DataParser.parse(String.class, map.get(PaperQuestionMeta.PAPER_ID)));
			this.setStatus(DataParser.parse(String.class, map.get(PaperQuestionMeta.STATUS)));
			this.setFileId(DataParser.parse(String.class, map.get(PaperQuestionMeta.FILE_ID)));
			this.setQuestionAnalysis(DataParser.parse(String.class, map.get(PaperQuestionMeta.QUESTION_ANALYSIS)));
			// others
			this.setQueryOwner(DataParser.parse(String.class, map.get(PaperQuestionMeta.QUERY_OWNER)));
			this.setLearn(DataParser.parse(Learn.class, map.get(PaperQuestionMeta.LEARN)));
			this.setLearnPaper(DataParser.parse(LearnPaper.class, map.get(PaperQuestionMeta.LEARN_PAPER)));
			this.setLevelDict(DataParser.parse(DictItem.class, map.get(PaperQuestionMeta.LEVEL_DICT)));
			this.setSelectedCode(DataParser.parse(String.class, map.get(PaperQuestionMeta.SELECTED_CODE)));
			return true;
		} else {
			try {
				this.setImageId( (String)map.get(PaperQuestionMeta.IMAGE_ID));
				this.setUpdateTime( (Date)map.get(PaperQuestionMeta.UPDATE_TIME));
				this.setSort( (Integer)map.get(PaperQuestionMeta.SORT));
				this.setVersion( (Integer)map.get(PaperQuestionMeta.VERSION));
				this.setQuestionNumber( (Integer)map.get(PaperQuestionMeta.QUESTION_NUMBER));
				this.setScore( (BigDecimal)map.get(PaperQuestionMeta.SCORE));
				this.setCreateBy( (String)map.get(PaperQuestionMeta.CREATE_BY));
				this.setDeleted( (Integer)map.get(PaperQuestionMeta.DELETED));
				this.setCreateTime( (Date)map.get(PaperQuestionMeta.CREATE_TIME));
				this.setUpdateBy( (String)map.get(PaperQuestionMeta.UPDATE_BY));
				this.setDeleteTime( (Date)map.get(PaperQuestionMeta.DELETE_TIME));
				this.setName( (String)map.get(PaperQuestionMeta.NAME));
				this.setLearnId( (String)map.get(PaperQuestionMeta.LEARN_ID));
				this.setDeleteBy( (String)map.get(PaperQuestionMeta.DELETE_BY));
				this.setId( (String)map.get(PaperQuestionMeta.ID));
				this.setQuestionType( (String)map.get(PaperQuestionMeta.QUESTION_TYPE));
				this.setQuestionLevel( (String)map.get(PaperQuestionMeta.QUESTION_LEVEL));
				this.setPaperId( (String)map.get(PaperQuestionMeta.PAPER_ID));
				this.setStatus( (String)map.get(PaperQuestionMeta.STATUS));
				this.setFileId( (String)map.get(PaperQuestionMeta.FILE_ID));
				this.setQuestionAnalysis( (String)map.get(PaperQuestionMeta.QUESTION_ANALYSIS));
				// others
				this.setQueryOwner( (String)map.get(PaperQuestionMeta.QUERY_OWNER));
				this.setLearn( (Learn)map.get(PaperQuestionMeta.LEARN));
				this.setLearnPaper( (LearnPaper)map.get(PaperQuestionMeta.LEARN_PAPER));
				this.setLevelDict( (DictItem)map.get(PaperQuestionMeta.LEVEL_DICT));
				this.setSelectedCode( (String)map.get(PaperQuestionMeta.SELECTED_CODE));
				return true;
			} catch (Exception e) {
				return false;
			}
		}
	}

	/**
	 * 从 Map 读取
	 * @param r 记录数据
	 * @param cast 是否用 DataParser 进行类型转换
	 * @return  是否读取成功
	*/
	public boolean read(ExprRcd r,boolean cast) {
		if(r==null) return false;
		if(cast) {
			this.setImageId(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.IMAGE_ID)));
			this.setUpdateTime(DataParser.parse(Date.class, r.getValue(PaperQuestionMeta.UPDATE_TIME)));
			this.setSort(DataParser.parse(Integer.class, r.getValue(PaperQuestionMeta.SORT)));
			this.setVersion(DataParser.parse(Integer.class, r.getValue(PaperQuestionMeta.VERSION)));
			this.setQuestionNumber(DataParser.parse(Integer.class, r.getValue(PaperQuestionMeta.QUESTION_NUMBER)));
			this.setScore(DataParser.parse(BigDecimal.class, r.getValue(PaperQuestionMeta.SCORE)));
			this.setCreateBy(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.CREATE_BY)));
			this.setDeleted(DataParser.parse(Integer.class, r.getValue(PaperQuestionMeta.DELETED)));
			this.setCreateTime(DataParser.parse(Date.class, r.getValue(PaperQuestionMeta.CREATE_TIME)));
			this.setUpdateBy(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.UPDATE_BY)));
			this.setDeleteTime(DataParser.parse(Date.class, r.getValue(PaperQuestionMeta.DELETE_TIME)));
			this.setName(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.NAME)));
			this.setLearnId(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.LEARN_ID)));
			this.setDeleteBy(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.DELETE_BY)));
			this.setId(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.ID)));
			this.setQuestionType(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.QUESTION_TYPE)));
			this.setQuestionLevel(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.QUESTION_LEVEL)));
			this.setPaperId(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.PAPER_ID)));
			this.setStatus(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.STATUS)));
			this.setFileId(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.FILE_ID)));
			this.setQuestionAnalysis(DataParser.parse(String.class, r.getValue(PaperQuestionMeta.QUESTION_ANALYSIS)));
			return true;
		} else {
			try {
				this.setImageId( (String)r.getValue(PaperQuestionMeta.IMAGE_ID));
				this.setUpdateTime( (Date)r.getValue(PaperQuestionMeta.UPDATE_TIME));
				this.setSort( (Integer)r.getValue(PaperQuestionMeta.SORT));
				this.setVersion( (Integer)r.getValue(PaperQuestionMeta.VERSION));
				this.setQuestionNumber( (Integer)r.getValue(PaperQuestionMeta.QUESTION_NUMBER));
				this.setScore( (BigDecimal)r.getValue(PaperQuestionMeta.SCORE));
				this.setCreateBy( (String)r.getValue(PaperQuestionMeta.CREATE_BY));
				this.setDeleted( (Integer)r.getValue(PaperQuestionMeta.DELETED));
				this.setCreateTime( (Date)r.getValue(PaperQuestionMeta.CREATE_TIME));
				this.setUpdateBy( (String)r.getValue(PaperQuestionMeta.UPDATE_BY));
				this.setDeleteTime( (Date)r.getValue(PaperQuestionMeta.DELETE_TIME));
				this.setName( (String)r.getValue(PaperQuestionMeta.NAME));
				this.setLearnId( (String)r.getValue(PaperQuestionMeta.LEARN_ID));
				this.setDeleteBy( (String)r.getValue(PaperQuestionMeta.DELETE_BY));
				this.setId( (String)r.getValue(PaperQuestionMeta.ID));
				this.setQuestionType( (String)r.getValue(PaperQuestionMeta.QUESTION_TYPE));
				this.setQuestionLevel( (String)r.getValue(PaperQuestionMeta.QUESTION_LEVEL));
				this.setPaperId( (String)r.getValue(PaperQuestionMeta.PAPER_ID));
				this.setStatus( (String)r.getValue(PaperQuestionMeta.STATUS));
				this.setFileId( (String)r.getValue(PaperQuestionMeta.FILE_ID));
				this.setQuestionAnalysis( (String)r.getValue(PaperQuestionMeta.QUESTION_ANALYSIS));
				return true;
			} catch (Exception e) {
				return false;
			}
		}
	}
}